#include "game.h"
void IB(char board [ROW][COL],int row,int col)
{
    int i;
    int j;
    for (i = 0;i < row; i++)
    {
        for(j = 0;j < col; j++)
        {
            board[i][j] = ' ';
        }
    }
}

void DB(char board [ROW][COL],int row,int col)
{
int i = 0;
for (i = 0;i < row; i++)
{
     int j = 0;
       for (j = 0;j < col; j++)
    {
          printf (" %c ",board[i][j]);
       if (j < col - 1)
          printf("|");
    }
     printf("\n");
if(i < row - 1)
     {
 int j = 0;
       for (j = 0;j < col; j++)
     {
          printf ("---"); 
        if (j < col - 1) 
           printf("|");
     }
        printf("\n");
     }
   }
}
void PM(char board [ROW][COL],int row,int col) 
{
   int m;
   int n;
printf ("玩家输入\n");
scanf("%d %d",&m,&n);
if(m >= 1 && m <= row && n >= 1 && n <= col)
{
if (board[m-1][n-1] == ' ')
    {
     board[m-1][n-1] = '*';
    }
    else
    {
      printf ("坐标被占用\n");
    }
}
    else
    {
      printf ("已被占用请重新输入\n");
    }

}
void CM(char board [ROW][COL],int row,int col)
{
printf ("电脑输入\n");

while (1) 
     {
        int x = rand() % row;
        int y = rand() % col;
        if (board[x][y] == ' ')
        {
           board[x][y] = ("#");
           break;
        }

      }
}